﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace iuPlace.Core.Services
{
    public abstract class Service : IDisposable
    {
        public Service(Session session)
        {
            this.Session = session;
        }

        public Session Session { get; private set; }

        protected void CheckSessionIsAuthenticated()
        {
            if (!this.Session.IsAuthenticated)
                throw new System.UnauthorizedAccessException(MessagesResource.Exception_Unauthorized);

        }

        protected void ExceptionNullReference()
        {
            throw new System.NullReferenceException(MessagesResource.Exception_NullReference);
        }

        public virtual void Dispose()
        {
            GC.SuppressFinalize(this);
        }
    }
}
